home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / AIncludes / FixMath.a < prev    next >
Encoding:
Text File  |  1992-01-29  |  2.9 KB  |  86 lines  |  [TEXT/MPS ]

  1. ; Version: 2.94
  2. ; Created: Friday, October 20, 1989 at 9:16:04 PM
  3.  
  4. ; File: FixMath.a
  5. ;
  6. ; Copyright Apple Computer, Inc. 1984-1991
  7. ; All Rights Reserved
  8. ;
  9.  
  10.  
  11.     IF &TYPE('__IncludingFixMath__') = 'UNDEFINED' THEN
  12. __IncludingFixMath__    SET    1
  13.  
  14. ; These calls support three types of fixed point numbers, each 32 bits long.
  15. ; The bits are interpreted as shown. The '-' represents the sign bit.
  16. ;
  17. ; Type <---------Integer Portion--------> <-------Fractional Portion------>
  18. ;LongInt -xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx.
  19. ;Fixed -xxxxxxx xxxxxxxx.xxxxxxxx xxxxxxxx
  20. ;Fract -x.xxxxxxxx xxxxxxxx xxxxxxxx xxxxxx
  21. ;
  22. ; Type LongInt can represent integers between +/-2147483647. Type Fixed can
  23. ; represent fractional quantities between +/-32768, with about 5 digits of
  24. ; accuracy. Type Fract can represent fractional quantities between +/-2 with
  25. ; about 9 digits of accuracy. These numeric representations are useful for
  26. ; applications that do not require the accuracy of the floating point routines,
  27. ; and which need to run as fast as possible. The Graf3D three dimensional
  28. ; graphics package resides on top of these routines. Although FixMul is in the
  29. ; file ToolTraps, it is shown below to show how it handles different types.
  30. ; Additional fixed point routines are described in the Inside Macintosh chapter,
  31. ; “Toolbox Utilities.”
  32.  
  33. ; FUNCTION FixMul(x, y: Fixed): Fixed;
  34. ; FixMul returns x * y. Note that FixMul effects "type * Fixed --> type":
  35. ; Fixed * Fixed --> Fixed
  36. ; LONGINT * Fixed --> LONGINT
  37. ; Fixed * LONGINT --> LONGINT
  38. ; Fract * Fixed --> Fract
  39. ; Fixed * Fract --> Fract
  40.  
  41. ; FUNCTION FracMul(x, y: Fract): Fract;
  42. ; FracMul returns x * y. Note that FracMul effects "type * Fract --> type":
  43. ; Fract * Fract --> Fract
  44. ; LONGINT * Fract --> LONGINT
  45. ; Fract * LONGINT --> LONGINT
  46. ; Fixed * Fract --> Fixed
  47. ; Fract * Fixed --> Fixed
  48.  
  49. ; FUNCTION FixDiv(x, y: Fixed): Fixed;
  50. ; FixDiv returns x / y. Note that FixDiv effects "type / type --> Fixed":
  51. ; Fixed / Fixed --> Fixed
  52. ; LONGINT / LONGINT --> Fixed
  53. ; Fract / Fract --> Fixed
  54. ; LONGINT / Fixed --> LONGINT
  55. ; Fract / Fixed --> Fract
  56.  
  57. ; FUNCTION FracDiv(x, y: Fract): Fract;
  58. ; FracDiv returns x / y. Note that FracDiv effects "type / type --> Fract":
  59. ; Fract / Fract --> Fract
  60. ; LONGINT / LONGINT --> Fract
  61. ; Fixed / Fixed --> Fract
  62. ; LONGINT / Fract --> LONGINT
  63. ; Fixed / Fract --> Fixed
  64.  
  65. ; FUNCTION FracSqrt(x: Fract): Fract;
  66. ; FracSqrt returns the square root of x. Both argument and result are regarded
  67. ; as unsigned.
  68.  
  69. ; FUNCTION FracCos(x: Fixed): Fract;
  70. ; FUNCTION FracSin(x: Fixed): Fract;
  71. ; FracCos and FracSin return the cosine and sine, respectively, given the
  72. ; argument x in radians.
  73.  
  74. ;The following routines are accessed via the glue code
  75. ;which will call the trap on a 128K ROM machine
  76.  
  77.  
  78. _FracCos          OPWORD      $A847
  79. _FracSin          OPWORD      $A848
  80. _FracSqrt         OPWORD      $A849
  81. _FracMul          OPWORD      $A84A
  82. _FracDiv          OPWORD      $A84B
  83. _FixDiv           OPWORD      $A84D
  84.  
  85.  
  86.     ENDIF    ; ...already included